/* Copyright (c) 2006, 2009, Carl Burch. License information is located in the
 * com.cburch.logisim.Main source code and at www.cburch.com/logisim/. */
 
package com.cburch.draw.undo;

public abstract class Action {
	
	/**
     * Not used.
     * Indicates if the <code>Action</code> is a modification.
     * @return <code>Boolean</code>
     */
    public boolean isModification() { return true; }

    /**
     * Returns the name of the <code>Action</code>.
     * @return <code>String</code> name of the <code>Action</code>
     */
    public abstract String getName();

    /**
     * Perform the <code>Action</code>.
     * @param proj <code>Project</code> to perform the <code>Action</code> on
     */
    public abstract void doIt();

    /**
     * Undoes the <code>Action</code>.
     * @param proj <code>Project</code> to undo
     */
    public abstract void undo();

    /**
     * Determines if the parameter <code>Action</code> should be appended to the <code>Action</code>.
     * @param other <code>Action</code> to test if it should be appended
     * @return <code>Boolean</code> indicating if the <code>Action</code> sould be appended
     */
    public boolean shouldAppendTo(Action other) { return false; }

    /**
     * Appends the <code>Action</code> other to the current <code>Action</code>.
     * @param other <code>Action</code> to append
     * @return <code>Action</code> consisting of the new <code>Actions</code>
     */
    public Action append(Action other) {
        return new ActionUnion(this, other);
    }
}
